<template>
  <div>
    <el-table size="small" :data="tcVisit" stripe>
      <el-table-column label="诊所名称" align="center" prop />
      <el-table-column label="回访人员" align="center" prop="visitPerson" />
      <el-table-column label="跟踪状态" align="center" prop="trackStatus" />
      <el-table-column label="消费状态" align="center" prop="consumeStatus" />
      <el-table-column label="回访内容" align="center" prop="contet" />
      <el-table-column label="回访结果" align="center" prop="result" />
      <el-table-column
        label="回访状态"
        align="center"
        prop="visitStatus"
        :formatter="ctReturnStatusFormat"
      />
      <el-table-column
        label="创建时间"
        align="center"
        prop="createTime"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="完成时间"
        align="center"
        prop="visitTime"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.visitTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="tcVisit"
    />
  </div>
</template>

<script>
export default {
  name: 'TCVisitRecordPane',
  props: {
    tcVisit: {
      type: Array,
      default() {
        return []
      },
    },
  },
  data() {
    return {
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 总条数
      total: 0,
      // tc回访表格数据
      tcList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      // tc 回访状态字典
      ctReturnStatusOptions: [],
    }
  },
  created() {
    this.getDicts('visit_status').then((response) => {
      this.ctReturnStatusOptions = response.data
    })
  },
  methods: {
    // tc 回访状态字典翻译
    ctReturnStatusFormat(row) {
      return this.selectDictLabel(this.ctReturnStatusOptions, row.visitStatus)
    },
  },
}
</script>
